home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_1
/
echelon
< prev
next >
Wrap
Text File
|
1995-03-31
|
2KB
|
102 lines
Subject: Matrix routines
BEGIN_RPL echelon.rpl
%%HP: T(3)A(D)F(.);
\<< \-> matr
\<<
IF 'matr' VTYPE
3 == matr SIZE SIZE
1 > AND
THEN 1 1 1 matr
SIZE LIST\-> DROP \->
det p q m n
\<<
WHILE 'p\<=m'
\->NUM 'q\<=n' \->NUM AND
REPEAT 0 p
\-> cmax k
\<< p m
FOR row
matr row q 2 \->LIST
GET ABS \-> x
\<<
IF 'x>cmax'
THEN x 'cmax' STO
row 'k' STO
END
\>>
NEXT
IF '
cmax>.00001'
THEN 1
n
FOR
col matr p col 2
\->LIST GET matr k
col 2 \->LIST GET \->
tp tk
\<< matr k col 2
\->LIST tp PUT 'matr'
STO matr p col 2
\->LIST tk PUT 'matr'
STO
\>>
NEXT
IF 'k
>p'
THEN
det NEG 'det' STO
END
matr p q 2 \->LIST
GET \-> l
\<< 1 n
FOR col matr p col
2 \->LIST GET l / \->
tl
\<< matr p col 2
\->LIST tl PUT 'matr'
STO
\>>
NEXT l det * 'det'
STO
\>> 1 m
FOR
row matr row q 2
\->LIST GET \-> l
\<< 1 n
FOR col
IF 'row\=/p'
THEN matr row
col 2 \->LIST GET
matr p col 2 \->LIST
GET l * - \-> tv
\<< matr row
col 2 \->LIST tv PUT
'matr' STO
\>>
END
NEXT
\>>
NEXT
'p' INCR DROP 'q'
INCR DROP
ELSE 0
'det' STO 'q' INCR
DROP
END
\>>
END
\>> matr
"Reduced Echelon Matrix
"
1 DISP 1 FREEZE
ELSE matr
"ECHEL Error:
Not A Matrix"
1 DISP 1400 .065
BEEP 1 FREEZE
END
\>>
\>>
END_RPL